<?php 

$reasonFamily = $this->question->getReasonFamily();


?>
<div id="topBox">
	<h1 class="title"><?php echo $this->question->name?></h1>
	<p class="questionCategory"><?php echo $this->question->getCategory()->name?></p>
	<div class="commerceInfo">	
		<img class="logo" src="/img/question/<?php echo $this->question->getId()?>.gif" alt="" title="" />		
		<div class="info">
		</div>
		<div class="clear"></div>
	</div>
	<div id="respond">
		<form id="voteForm">
		<?php echo $this->formHidden("questionId", $this->question->getId())?>
		<h3>¿Estas de acuerdo?</h3>
		<?php echo $this->formRadio("value", null, null, array('positive' =>'Si', 'negative' => 'No'))?>
		
		<?php 
		if ($reasonFamily){
			
			$reasons = $reasonFamily->getReasons();
			
			if (count($reasons)){
		?>
		<div class="why">
			<h3>¿Por qué?</h3>
			<select name="reason" id="reason">
			<option value=""></option> 
			<?php 
			foreach($reasons as $reason){
			?>	
			<option value="<?php echo $reason->getId()?>" positive="<?php echo $reason->positive?>" ><?php echo $reason->name?></option>
			<?php 	
			}
			?>
			</select>
			
		</div>
		<?php }}?>
		<?php echo $this->formSubmit('submit', 'Votar')?>
		</form>
	</div>
</div>
	<div id="tabs">
		<ul class="menu">
			<li><a href="#tabs-1">Votos</a></li>
			<li><a href="#tabs-2">Información</a></li>
			<li><a href="#tabs-3">Comentarios</a></li>
		</ul>
		<div id="tabs-1" class="bottomBox">
			<h2>Votos</h2>
			
			<div id="visualization" style="width: 500px; height: 300px;"></div>
			
		</div>
		<div id="tabs-2" class="bottomBox">
			<h2>Información detallada</h2>
			<?php echo $this->question->description?>
		</div>
		<div id="tabs-3" class="bottomBox">
			<h2>Dejá tu comentario</h2>
		</div>		
	</div>
<?php 


$this->jQuery()->addJavascriptFile('http://www.google.com/jsapi');
// $this->jQuery()->addJavascriptFile('http://platform.twitter.com/widgets.js');
//$this->jQuery()->addJavascriptFile('https://platform.twitter.com/widgets.js');


$this->jQuery()->javascriptCaptureStart();
?>
google.load('visualization', '1', {
	packages: ['corechart']});
	
	
	function drawVisualization() {
        // Create and populate the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Task');
        data.addColumn('number', 'Hours per Day');
        data.addRows(5);
        data.setValue(0, 0, 'Si');
        data.setValue(0, 1, <?php echo $this->question->getAnswers()->countPositive()?>);
        data.setValue(1, 0, 'No');
        data.setValue(1, 1, <?php echo $this->question->getAnswers()->countNegative()?>);
      
        // Create and draw the visualization.
        new google.visualization.PieChart(document.getElementById('visualization')).
            draw(data, {title:"¿Estas de acuerdo?"});
      }	
	
<?php	
$this->jQuery()->javascriptCaptureEnd();

$this->jQuery()->onLoadCaptureStart();


?>
<!-- initNegocioLike(); -->
$("#tabs" ).tabs();
drawVisualization();
<?php $this->jQuery()->onLoadCaptureEnd();




